package com.masterclient.app.modules.income.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eoner.baselibrary.utils.Utils;
import com.masterclient.app.R;
import com.masterclient.app.modules.income.model.BillBean;

public class WithDrawAdapter extends BaseQuickAdapter<BillBean.BillItemBean, BaseViewHolder> {

    public WithDrawAdapter() {
        super(R.layout.item_withdraw);
    }

    @Override
    protected void convert(BaseViewHolder helper, BillBean.BillItemBean item) {

        View viewItem = helper.getView(R.id.view_item);
        TextView tvTitle = helper.getView(R.id.tv_title);
        TextView tvAccount = helper.getView(R.id.tv_account);
        TextView tvTime = helper.getView(R.id.tv_time);

        if("2".equals(item.bizType)){
            //支出
            tvAccount.setText(String.format("-%s", item.amount));
            tvAccount.setTextColor(Color.parseColor("#141922"));
        }else {
            //收入
            tvAccount.setText(String.format("+%s", item.amount));
            tvAccount.setTextColor(Color.parseColor("#FC2A52"));
        }
        Utils.setDin(tvAccount,mContext);
        tvTitle.setText(item.billTitle);
        tvTime.setText(item.createAt);
    }
}
